Given $a \neq 0,$ solve for $x$ in
\[\begin{vmatrix} x + a & x  & x \\ x & x + a & x \\ x & x & x + a \end{vmatrix} = 0.\]Give your answer in terms of $a.$
Solution: We can expand the determinant as follows:
\begin{align*}
\begin{vmatrix} x + a & x  & x \\ x & x + a & x \\ x & x & x + a \end{vmatrix} &= (x + a) \begin{vmatrix} x + a & x \\ x & x + a \end{vmatrix} - x \begin{vmatrix} x & x \\ x & x + a \end{vmatrix} + x \begin{vmatrix} x & x + a \\ x & x \end{vmatrix} \\
&= (x + a)((x + a)^2 - x^2) - x(x(x + a) - x^2) + x(x^2 - (x + a)(x)) \\
&= 3a^2 x + a^3 \\
&= a^2 (3x + a).
\end{align*}Hence, $x = \boxed{-\frac{a}{3}}.$